package dj.common.exception;

/**
 * <br>
 * <p>德基：中心API异常</p><br>
 *
 * @author ZJG
 * @version 1.0
 * @date 2021/7/7 下午4:00
 */
public class CentralException extends BaseException {

    /**
     * @param message 异常msg
     */
    public CentralException(String message) {
        super(message);
    }

    /**
     *
     * @param cause
     */
    public CentralException(Throwable cause) {
        super(cause);
    }

    /**
     * @param code      异常码
     * @param message   异常msg
     */
    public CentralException(int code, String message) {
        super(code, message);
    }

    /**
     * @param deJiDomainType
     *        业务domain channel 或 biz units业务单元
     * @param cause 异常详情
     */
    public CentralException(Object deJiDomainType, Throwable cause) {
        super(deJiDomainType.toString(), cause);
    }

    /**
     *
     * @param deJiDomainType
     *        业务domain channel 或 biz units业务单元
     * @param message
     */
    public CentralException(Object deJiDomainType, String message) {
        super(deJiDomainType.toString() + ", error_msg: " + message);
    }

    /**
     *
     * @param deJiDomainType
     *          业务domain channel
     * @param bizUnit
     *          biz units业务单元
     * @param cause
     */
    public CentralException(Object deJiDomainType, Object bizUnit, Throwable cause) {
        super(deJiDomainType.toString() + ", bizUnit: " + bizUnit.toString(), cause);
    }

    /**
     * @param deJiDomainType        业务domain channel
     * @param bizUnit               biz units业务单元
     * @param message
     */
    public CentralException(Object deJiDomainType, Object bizUnit, String message) {
        super(deJiDomainType.toString() + ", bizUnit: " + bizUnit.toString() + ", error_msg: " + message);
    }

    /**
     * @param deJiDomainType
     *        业务domain channel 或 biz units业务单元
     * @param code           异常码
     * @param message        异常msg
     */
    public CentralException(Object deJiDomainType, int code, String message) {
        super(deJiDomainType.toString(), code, message);
    }

    /**
     * @param deJiDomainType    业务domain channel
     * @param bizUnit           biz units业务单元
     * @param code              异常码
     * @param message           异常msg
     */
    public CentralException(Object deJiDomainType, Object bizUnit, int code, String message) {
        super(deJiDomainType.toString()+ ", " + bizUnit.toString(), code, message);
    }

    @Override
    public String toString() {
        return "CentralException: " + code + ": " + message;
    }
}
